<script setup>
import {useRouter} from "vue-router";
const router = useRouter();
function paramsTest(){
  // router.push('/haha/1/chenxin/21');
  router.push({
    name: 'Haha',
    params: {
      id: 1,
      name: 'chenxin',
      age: '21'
    }
  });
}
</script>

<template>
  <router-link to="/">首页</router-link>
  <router-link to="/hello?id=1&name=chenxin">hello1</router-link>
  <router-link :to="{
    path: '/hello',
    query: {
      id: 1,
      name: 'chenxin'
    }
  }">hello2</router-link>

  <router-link to="/haha/1/chenxin/21">haha1</router-link>
  <router-link :to="{
    name: 'Haha',
    params: {
      id: 1,
      name: 'chenxin',
      age: '21'
    }
  }">haha2</router-link>
  <button @click="paramsTest">跳转</button>
  <router-link to="/user/777">个人中心</router-link>
  <hr/>
  <router-view/>
</template>

<style scoped>
</style>
